<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="utf-8"/>
<title>后台管理系统</title>
<meta name="author" content="DeathGhost" />
<link rel="stylesheet" type="text/css" th:href="@{/css/style.css}">
<!--[if lt IE 9]>
<script th:src="@{/js/html5.js}"></script>
<![endif]-->
 <!--依次引用Vue和Axios-->
 <!--D:/MAVEN/repository/org/webjars/npm/vue/2.6.14/vue-2.6.14.jar!/META-INF/resources/webjars/vue/2.6.14/dist/vue.js-->
 <script type="text/javascript" th:src="@{/webjars/vue/2.6.14/dist/vue.js}"></script>
 <!--D:/MAVEN/repository/org/webjars/npm/axios/0.26.1/axios-0.26.1.jar!/META-INF/resources/webjars/axios/0.26.1/dist/axios.js-->
 <script type="text/javascript" th:src="@{/webjars/axios/0.26.1/dist/axios.js}"></script>
<script th:src="@{/js/jquery.js}"></script>
<script th:src="@{/js/jquery.mCustomScrollbar.concat.min.js}"></script>
<script>

	(function($){
		$(window).load(function(){
			
			$("a[rel='load-content']").click(function(e){
				e.preventDefault();
				var url=$(this).attr("href");
				$.get(url,function(data){
					$(".content .mCSB_container").append(data); //load new content inside .mCSB_container
					//scroll-to appended content 
					$(".content").mCustomScrollbar("scrollTo","h2:last");
				});
			});
			
			$(".content").delegate("a[href='top']","click",function(e){
				e.preventDefault();
				$(".content").mCustomScrollbar("scrollTo",$(this).attr("href"));
			});
			
		});
	})(jQuery);
</script>
</head>
<body>
<!--header-->
<header>
 <h1><img th:src="@{/images/admin_logo.png}"/></h1>
 <ul class="rt_nav">
  <li><a th:href="@{/http://www.mycodes.net}" target="_blank" class="website_icon">站点首页</a></li>
  <li><a th:href="@{#}" class="clear_icon">清除缓存</a></li>
  <li><a th:href="@{#}" class="admin_icon">DeathGhost</a></li>
  <li><a th:href="@{#}" class="set_icon">账号设置</a></li>
  <li><a th:href="@{/login.html}" class="quit_icon">安全退出</a></li>
 </ul>
</header>
<!--aside nav-->
<!--aside nav-->
<aside class="lt_aside_nav content mCustomScrollbar">
 <h2><a th:href="@{/index.html}">起始页</a></h2>
 <ul>
  <li>
   <dl>
    <dt>常用布局示例</dt>
    <!--当前链接则添加class:active-->
    <dd><a th:href="@{/product_list.html}">商品列表示例</a></dd>
    <dd><a th:href="@{/product_detail.html}">商品详情示例</a></dd>
    <dd><a th:href="@{/recycle_bin.html}">商品回收站示例</a></dd>
   </dl>
  </li>
  <li>
   <dl>
    <dt>订单信息</dt>
    <dd><a th:href="@{/order_list.html}">订单列表示例</a></dd>
    <dd><a th:href="@{/order_detail.html}">订单详情示例</a></dd>
   </dl>
  </li>
  <li>
   <dl>
    <dt>会员管理</dt>
    <dd><a th:href="@{/user_list.html}" class="active">会员列表示例</a></dd>
    <dd><a th:href="@{/address_list.html}">收货地址列表示例</a></dd>
    <dd><a th:href="@{/user_rank.html}">会员等级示例</a></dd>
    <dd><a th:href="@{/adjust_funding.html}">会员资金管理示例</a></dd>
   </dl>
  </li>
  <li>
   <dl>
    <dt>基础设置</dt>
    <dd><a th:href="@{/setting.html}">站点基础设置示例</a></dd>
   </dl>
  </li>
  <li>
   <dl>
    <dt>配送与支付设置</dt>
    <dd><a th:href="@{/express_list.html}">配送方式</a></dd>
    <dd><a th:href="@{/pay_list.html}">支付方式</a></dd>
   </dl>
  </li>
  <li>
   <dl>
    <dt>在线统计</dt>
    <dd><a th:href="@{/discharge_statistic.html}">流量统计</a></dd>
    <dd><a th:href="@{/sales_volume.html}">销售额统计</a></dd>
   </dl>
  </li>
  <li>
   <p class="btm_infor">© DeathGhost.cn 版权所有</p>
  </li>
 </ul>
</aside>

<section class="rt_wrap content mCustomScrollbar">
 <div class="rt_content" id="app">
      <div class="page_title">
       <h2 class="fl">会员详情</h2>
       <a th:href="@{/adjust_funding.html}" class="fr top_rt_btn money_icon">资金管理</a>
      </div>

  <form @submit.prevent="submit">
   <input type="hidden" th:value="${id}" id="id">
   <ul class="ulColumn2">
    <li class="form-group-sm">
     <span class="item_name" style="width:120px;">用户名：</span>
     <input type="text" class="textbox textbox_225 form-control" name="username" v-model="userMessage.username"/>
    </li>
    <li class="form-group-sm">
     <span class="item_name" style="width:120px;">生日：</span>
     <input type="date" class="textbox textbox_225 form-control" name="birthday" v-model="userMessage.birthday"/>
    </li>
    <li class="form-group-sm">
     <span class="item_name" style="width:120px;">性别：</span>
     <select class="select form-control" v-model="userMessage.sex" name="sex">
      <option value="0">请选择性别</option>
      <option value="1">男</option>
      <option value="2">女</option>
     </select>
    </li>
    <li class="form-group-sm">
     <span class="item_name" style="width:120px;">余额：</span>
     <input type="text" class="textbox textbox_225 form-control" name="balance" v-model="userMessage.balance"/>
    </li>
    <li class="form-group-sm">
     <span class="item_name" style="width:120px;"></span>
     <button class="link_btn">更新/保存</button>
    </li>
    <!--<li>
     <span class="item_name" style="width:120px;">上传头像：</span>
     <label class="uploadImg">
      <input type="file"/>
      <span>上传头像</span>
     </label>
    </li>-->
    <!--<li>
     <span class="item_name" style="width:120px;">手机号码：</span>
     <input type="tel" class="textbox textbox_225" value="18300000000" placeholder="手机号码..."/>
     <span class="errorTips">错误提示信息...</span>
    </li>
    <li>
     <span class="item_name" style="width:120px;">可用资金：</span>
     <input type="text" class="textbox textbox_225" value="1599.00" placeholder="可用资金（单位：元）..." readonly/>
     <span>元</span>
    </li>
    <li>
     <span class="item_name" style="width:120px;">冻结资金：</span>
     <input type="text" class="textbox textbox_225" value="100.00" placeholder="冻结资金（单位：元）..." readonly/>
     <span>元</span>
    </li>
    <li>
     <span class="item_name" style="width:120px;">收货地址：</span>
     <select class="select">
      <option>选择省份</option>
      <option>陕西省</option>
      <option>山西省</option>
     </select>
     <select class="select">
      <option>选择城市</option>
      <option>西安市</option>
      <option>大同市</option>
     </select>
     <select class="select">
      <option>选择区/县</option>
      <option>长安县</option>
      <option>不晓得</option>
     </select>
    </li>
    <li>
     <span class="item_name" style="width:120px;">详细地址：</span>
     <input type="text" class="textbox textbox_295" value="陕西省西安市未央区凤城五路旺景国际大厦" placeholder="详细地址..."/>
     <span class="errorTips">错误提示信息...</span>
    </li>-->
   </ul>
  </form>
 </div>
</section>
<script type="text/javascript">
 var vm = new Vue({
  el: "#app",
  data: {
   userMessage: {
    id: null,
    sex: null,
    birthday: null,
    balance: null,
    username: null
   }
  },
  mounted: function () {
   var id = document.getElementById("id").value;
   axios.get('/userMessage/one/' + id)
           .then(function (response) {
            vm.userMessage.id = id;
            vm.userMessage.sex = response.data.sex;
            vm.userMessage.birthday = response.data.birthday;
            vm.userMessage.balance = response.data.balance;
            vm.userMessage.username = response.data.username;
           });
  },
  methods: {
   submit: function () {
    if(vm.userMessage.id==null || vm.userMessage.id==undefined){
     alert('请选择用户');
     return;
    }
    if(vm.userMessage.sex==null || vm.userMessage.sex==undefined || vm.userMessage.sex==0){
     alert('请选择性别');
    }
    if(vm.userMessage.birthday==null || vm.userMessage.birthday==undefined){
     alert('请选择生日');
     return;
    }
    if(vm.userMessage.balance==null || vm.userMessage.balance==undefined){
     alert('请输入余额');
    }
    if(vm.userMessage.username==null || vm.userMessage.username==undefined){
     alert('请输入用户名');
    }
    var id = document.getElementById("id").value;
    vm.userMessage.id = id;
    axios.post('/userMessage/update',vm.userMessage)
            .then(function (response) {
             if(response.data=="success"){
              alert("success");
             }else {
              alert("fail");
             }
            })
   }
  }
 });
</script>
</body>
</html>
